import React, {Component} from 'react';
import 'core-js';
import './App.css';
import {Consumer, Provider} from "./store";


import {Route, BrowserRouter as Router, Switch} from 'react-router-dom';
import Index from './views/Index';
import Login from './views/login';


class App extends Component {
    constructor() {
        super();
        this.state = {
            orderStatus: {
                page:1,
                size:10,
                output_num: undefined,
                output_status: undefined,
                customer_name: undefined,
                order_time_start: undefined,
                order_time_end: undefined,
                delivery_time_start: undefined,
                delivery_time_end: undefined
            },
            menuType:"菜单类型",
            dispatch: (data) => {
                const state = this.state;
                const newState = Object.assign({}, state, data);
                this.setState(newState);
            }
        }
    }

    render() {
        return (
            <Provider value={this.state}>
                <Router>
                    <Switch>
                        <Route path="/index" component={Index}/>
                        <Route path="/login" component={Login}/>
                        <Route component={Login}/>
                    </Switch>
                </Router>
            </Provider>
        );
    }
}

export default App;
